UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dycip2IbLqaInXhdDpkT7a+T7vvV4+ZS6qac3p5Rjlo='
WHERE
key_id = 'd1acdfeea098a78d2364b7c6865ffbbef93b99dc17363454af8617b7ce5ec5b8'
AND (
token = 'dycip2IbLqaInXhdDpkT7a+T7vvV4+ZS6qac3p5Rjlo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)