UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZgQGXjR9Y+RxPHUkI5cnwFSNctqPy8i6cr6eGrGAhmc=' 
WHERE 
  key_id = '708376a097a03168d53ca78a1ffdf0f52d916ce98f787f3f2403b29091fe5738' 
  AND (
    token = 'ZgQGXjR9Y+RxPHUkI5cnwFSNctqPy8i6cr6eGrGAhmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022