UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FSEzGdsgy2OCQ8FgQaBNTyTBoFWVuf2rD6ZIVCOd8D8=' 
WHERE 
  key_id = '344c8f5c8d53d62acd00a792b2aadca7f39c19350712cc52b749eba17f800d22' 
  AND (
    token = 'FSEzGdsgy2OCQ8FgQaBNTyTBoFWVuf2rD6ZIVCOd8D8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048