UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lZH6goGRcljtB/kb3FFvD9PP4fMCv+aSa9sG6t5PMgU=' 
WHERE 
  key_id = '5ef2d4acf703b694f3aaaeed89d7dd790ab2f1d198d59ebb5d6a5e2c2329c7a8' 
  AND (
    token = 'lZH6goGRcljtB/kb3FFvD9PP4fMCv+aSa9sG6t5PMgU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030