UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uhxqAR66v0pAoL8afrX31n5HXGXnvJw97lyMltVX304='
WHERE
key_id = 'edaf33b4134a1652c546df174e905bde91ce4015768e7272f17c4172f6da3336'
AND (
token = 'uhxqAR66v0pAoL8afrX31n5HXGXnvJw97lyMltVX304='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)