UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cwxqLpaljqrnLvrQl7k7z3DgB8TLRf+7t7yqe4e6VOc=' 
WHERE 
  key_id = '4ba14ff003a076daeda8e1ac9f44b386f7f2082c802f33a15549413cdc4d94fc' 
  AND (
    token = 'cwxqLpaljqrnLvrQl7k7z3DgB8TLRf+7t7yqe4e6VOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025