UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F8HZH9vxZfYjEyhgJ8gDc0kL0ZwFdeeuMMAXm1UcB7U=' 
WHERE 
  key_id = 'fa9265e74f49ff7857d4d65ba561e6abd379146641796346c566b03e79bc2ee9' 
  AND (
    token = 'F8HZH9vxZfYjEyhgJ8gDc0kL0ZwFdeeuMMAXm1UcB7U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017