UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cTh2XtX4Fl4cTuuWli4NZI+ksL7KcL2mnAaip/WrvUY=' 
WHERE 
  key_id = '5e45cade421ddd45831b95fc3837f50abe6f9c15edcf16e281f19cf1827d30b7' 
  AND (
    token = 'cTh2XtX4Fl4cTuuWli4NZI+ksL7KcL2mnAaip/WrvUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038