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