UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gsXuUOp5S4wgXGJEGKfGn/7Y14ygcGJzSBz9MHYc5u4='
WHERE
key_id = 'f38c4aba26eeedfc1a1b1b6493da76337b071418ffc020c029ad0ab526bb4b1f'
AND (
token = 'gsXuUOp5S4wgXGJEGKfGn/7Y14ygcGJzSBz9MHYc5u4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)