UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tfLN+vB8evlIUAqHI0TOBWdy2jJp/ctyVQMPaRW3Tck=' 
WHERE 
  key_id = '65d47a3211d75454e0045921a31fb0a683a795dc5bc24438e93040670b88e82d' 
  AND (
    token = 'tfLN+vB8evlIUAqHI0TOBWdy2jJp/ctyVQMPaRW3Tck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028