UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xwl9c2L/1smZfoERvBeJvg7Bm2OApxr69Sz594kpDXs=' 
WHERE 
  key_id = 'f6e2761e6e50e97e64567614379c04862d70bf01f100bdf2fb086f89b75d8085' 
  AND (
    token = 'Xwl9c2L/1smZfoERvBeJvg7Bm2OApxr69Sz594kpDXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024