UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1dzBpTVIsxqb35+49yUQPlzlerWufXasmCyePhrK2OU=' 
WHERE 
  key_id = '848cdfb26061f3e5e27f245a6f9285a17516b23ccba951306a2465f08ce98ecf' 
  AND (
    token = '1dzBpTVIsxqb35+49yUQPlzlerWufXasmCyePhrK2OU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036