UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TWYjSCI2gLzyu8I0YKoyTjwo+GazYcf4eOPRfkfbYBE=' 
WHERE 
  key_id = '80a42f16ee4da2dda9f542a3a6ec487660e45311a5548357cc2e17286b10c10c' 
  AND (
    token = 'TWYjSCI2gLzyu8I0YKoyTjwo+GazYcf4eOPRfkfbYBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054