UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nYh18k4an7Z/vO4wQxPFcr0sapBiWtaV62muTxWVif4='
WHERE
key_id = 'b16781d0000c939ebb7edd2235fcb7d8f5ac4330bac1b2017fffc90b48eec962'
AND (
token = 'nYh18k4an7Z/vO4wQxPFcr0sapBiWtaV62muTxWVif4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)