UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wg0RCi88TUM2cj+bD/6OY9Xgeeyh1cTdvy+UzvB2QJM=' 
WHERE 
  key_id = '1d1ac50fbec61acdce5b811710e274e5dc1fb65088210a60815161887f19502e' 
  AND (
    token = 'Wg0RCi88TUM2cj+bD/6OY9Xgeeyh1cTdvy+UzvB2QJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036