UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nzoo2NSaYATkE3nAXu9F1tRP0dHlgBH/U3bm4A+Z3xk=' 
WHERE 
  key_id = 'a4b34c8104bbd058e2f5f14914775b96c3a3e69c14709df6e1097738b36bfec7' 
  AND (
    token = 'nzoo2NSaYATkE3nAXu9F1tRP0dHlgBH/U3bm4A+Z3xk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038