UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K7JhSiBIO3q653gFdES3nEfTfzoVUsx7j3JneSGmbZU=' 
WHERE 
  key_id = '99ed5bb7972845e998a9798ff0f2c1e51ace775a41b3afa57cfd0fb4a98f4c51' 
  AND (
    token = 'K7JhSiBIO3q653gFdES3nEfTfzoVUsx7j3JneSGmbZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032