UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fNgiayceYa0U1m7zyaDFZKqHDHKjVFRzWy6rqP9tB+c='
WHERE
key_id = '48df3a839be8d4d072fa1cf4535aaa352e680421231c5bd2ccaa08031d402c19'
AND (
token = 'fNgiayceYa0U1m7zyaDFZKqHDHKjVFRzWy6rqP9tB+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)