UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dukhhB60q4d7HY10wKJ9726AFIzdLwx20sJcw4GnGS4=' 
WHERE 
  key_id = '4cfd9c45a1492b0a5cbd96b3e91aac40f81d05ce005a99bc76e2ae18589ef528' 
  AND (
    token = 'dukhhB60q4d7HY10wKJ9726AFIzdLwx20sJcw4GnGS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050