UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wtb6pD/aOsJtgoflDt0pnatkONqtxv+QabwuS4q+eyQ=' 
WHERE 
  key_id = 'a0624576bfdf73b398f521107486863b4efeeafc425faabaf734aadba5beadee' 
  AND (
    token = 'wtb6pD/aOsJtgoflDt0pnatkONqtxv+QabwuS4q+eyQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052