UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kqGe5xIuGAqx+43g/xI+czoSP4xG8KsWlFpc4s0v4A4='
WHERE
key_id = '5dea16bb2b9c8a15d456388149d68f5e1c525d16b563187569f04a7c05811bc3'
AND (
token = 'kqGe5xIuGAqx+43g/xI+czoSP4xG8KsWlFpc4s0v4A4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)