UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XyxugVhLZ7lbB1h5F4EyIH0qWWTHnRgJDCnWq+K+tRM=' 
WHERE 
  key_id = '3ab352ffb44fdcf29770c4739a6e4aa24da8270e5a4280fb552ebfd2e5f26f05' 
  AND (
    token = 'XyxugVhLZ7lbB1h5F4EyIH0qWWTHnRgJDCnWq+K+tRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029