UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LKwdSPFomznGDO15jJiZgU1pgvWp+M/ZMTeo7SV+zfs=' 
WHERE 
  key_id = '5c6db3f3629a009059a53de02d79aa4d50ade39ffb2f1b90fc3d7b3f2dfdf6d8' 
  AND (
    token = 'LKwdSPFomznGDO15jJiZgU1pgvWp+M/ZMTeo7SV+zfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042