UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y53VyefMqM/O5zZAlR1UWaN8UxH+asp7pnkiv8EOxE8=' 
WHERE 
  key_id = '0c9b2bb818c3609dfed3051d21662a351506850ddf2ca0f72d28463dea412d11' 
  AND (
    token = 'y53VyefMqM/O5zZAlR1UWaN8UxH+asp7pnkiv8EOxE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022