UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KwFnmhWzwLyIc49W80mmiPsVb/0dgNNdVNg/PSM57PU=' 
WHERE 
  key_id = 'a587f50fc8610f95c3ad9414ff1e85b8809eb2d4ebf60ec796183a2b272f77fb' 
  AND (
    token = 'KwFnmhWzwLyIc49W80mmiPsVb/0dgNNdVNg/PSM57PU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035