UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k9H5ruWgBhQosWbN+Piw1XPyPsRU+DS7jOL2blwhuiI=' 
WHERE 
  key_id = '8cb1ec70ea5ad1f954d226fd44148a551a08766f6b372adb069caa29ae1e63f7' 
  AND (
    token = 'k9H5ruWgBhQosWbN+Piw1XPyPsRU+DS7jOL2blwhuiI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030