UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y3iXLvQYYFhu8RRbwnNMpn1LhxmQ3ftoV+ZXnKG7M9s=' 
WHERE 
  key_id = '56b9b276217cea6b1bd298689de4496a5942d8f2e0f5823ddf04819fec12a680' 
  AND (
    token = 'y3iXLvQYYFhu8RRbwnNMpn1LhxmQ3ftoV+ZXnKG7M9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048