UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A/7HvksSAWltWciPX4R9WMzg6Y2GLtglA2L+bwNUizs='
WHERE
key_id = 'ea8cd8a7be62a536282a99e4368d4d49fc1f6ade6f3e649d421fa0b3e65fae50'
AND (
token = 'A/7HvksSAWltWciPX4R9WMzg6Y2GLtglA2L+bwNUizs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)