UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IvdXdTRGr/ocAEDjDlsBn3x4gN4FORjGDLyXOV+32/I='
WHERE
key_id = 'b8d137dbba167811e58984c388ec7be66255e962dc75de0e984c05319ecd6db1'
AND (
token = 'IvdXdTRGr/ocAEDjDlsBn3x4gN4FORjGDLyXOV+32/I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)