UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fO9+i9UK4zT2X9jIEpcQj8HZYkhUhffSPPYCED/OvsA=' 
WHERE 
  key_id = 'bab15e9da7685ca3d3811ca96105f9f1f290656300e9ca9dd08de039beecf516' 
  AND (
    token = 'fO9+i9UK4zT2X9jIEpcQj8HZYkhUhffSPPYCED/OvsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041