UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r/i6vWb/6ahrrgPaboYmVN3FvKiycoAOPVWe2MDe6Fw=' 
WHERE 
  key_id = 'fcc3ae01e0b4b764e74b775b3dbfa341aef15852032fde7e7321e9ca756838a8' 
  AND (
    token = 'r/i6vWb/6ahrrgPaboYmVN3FvKiycoAOPVWe2MDe6Fw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047