UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cXLp2a6D+0OqqyHmBca3WWjmrXVAtn5svLc4nPIWnTA=' 
WHERE 
  key_id = '670199446bf625b0b0e9c33d40ff898adda06726e2b1dba701160dc1395a7058' 
  AND (
    token = 'cXLp2a6D+0OqqyHmBca3WWjmrXVAtn5svLc4nPIWnTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025