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