UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mM5NRZxPPXJorqLURINBuY98slFZuVmirpZ+Aa3PSPg=' 
WHERE 
  key_id = 'ebb4f6c445401c8e7fd2b01e8dc38fbc77d00c1ff9b460821f419632d3a59db7' 
  AND (
    token = 'mM5NRZxPPXJorqLURINBuY98slFZuVmirpZ+Aa3PSPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057