UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/g4TArP5r9ipe+ySyP9r1XrfpS5f7GUVeePTPz5OlB0='
WHERE
key_id = 'a1c74a83ad69705ccee47284391f3a13fd727b795ae139fe0d9148e92f4a02f7'
AND (
token = '/g4TArP5r9ipe+ySyP9r1XrfpS5f7GUVeePTPz5OlB0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)