UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'djaWtHpCTRB+E27Ub6iyTfLkHkas8LnQiSkga1eq/+U=' 
WHERE 
  key_id = 'fcc02ad8a67a1ba3a4a234a76b68892be136a84d6b7b91b5144909958f392679' 
  AND (
    token = 'djaWtHpCTRB+E27Ub6iyTfLkHkas8LnQiSkga1eq/+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027