UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gCgR/dEpz9TYO1w0MPpVhHxzhynop8BXQ5Fze90/spo=' 
WHERE 
  key_id = '22379ad5199008cc47d2e394c06267d785e0d006fab69d62f35b4999a12c51fc' 
  AND (
    token = 'gCgR/dEpz9TYO1w0MPpVhHxzhynop8BXQ5Fze90/spo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023