UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uoB+OVCAW7qjgcGRdIOhTiN5ZMY4ejQppV8WvvYrQPM=' 
WHERE 
  key_id = '40b2cfef3766aa6eeb0931c39907c390e424fb30c841e48afd7259bec4117074' 
  AND (
    token = 'uoB+OVCAW7qjgcGRdIOhTiN5ZMY4ejQppV8WvvYrQPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015