UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wdgiXpQHZUP8mbi2SaRPk27+VXNFDmaXXnWCaQojKWA=' 
WHERE 
  key_id = 'ebda15c9ef7bee641616bbca815e05922b01f25d09571e15153d2768779b6153' 
  AND (
    token = 'wdgiXpQHZUP8mbi2SaRPk27+VXNFDmaXXnWCaQojKWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046