UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SHmUb3fL/LauOv9IP6RPEwWFZxpY4M3uOAbDbVE4Exk='
WHERE
key_id = 'f971772d0113ecedc22bc8f00d512bad890f631310c9893c1e2b93968c8ac314'
AND (
token = 'SHmUb3fL/LauOv9IP6RPEwWFZxpY4M3uOAbDbVE4Exk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)