UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5wFYtTbU1yJyQIWWCyEB+63ZXEe07WTlHLbyY8mYCAA=' 
WHERE 
  key_id = '2aefec3507d33da9d6d35d78f2ab69f5616384928cd7895f46b699c29e63d533' 
  AND (
    token = '5wFYtTbU1yJyQIWWCyEB+63ZXEe07WTlHLbyY8mYCAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032