UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rUBdIns/anJWhX1OJ5e3zwcmWXtMsu+OnGD+1+Gd/H4=' 
WHERE 
  key_id = 'f20aff97c95e66e7516d9068722626d6fed6c32c45ba70efe2e363b45231141f' 
  AND (
    token = 'rUBdIns/anJWhX1OJ5e3zwcmWXtMsu+OnGD+1+Gd/H4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037