UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R4DvXTxxJux82qiwcoaLpeSBiLi6x0eDG3xFqCFZvUY='
WHERE
key_id = '00cdf5246a1478fb12723013de44985ccf399bd025889f35cf2c022a2afaa000'
AND (
token = 'R4DvXTxxJux82qiwcoaLpeSBiLi6x0eDG3xFqCFZvUY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)