UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dfeLcMzwgBnCF/Ab5XKdTtz1ds2XlSYvVjlJCgIIIeA=' 
WHERE 
  key_id = 'e5b495882b6cd434911b29977357a29cb2db364b48620ebc697a8b8b33dda6ca' 
  AND (
    token = 'dfeLcMzwgBnCF/Ab5XKdTtz1ds2XlSYvVjlJCgIIIeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016