UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sCuWUU5lAPYtiQbRQjuVDEaCB8IE5p3WNzgmEr6jMbQ=' 
WHERE 
  key_id = 'd51709a8de664681e93e49cf5667d44d066af6b910a90b6db0c00abf1cf1ab89' 
  AND (
    token = 'sCuWUU5lAPYtiQbRQjuVDEaCB8IE5p3WNzgmEr6jMbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030