UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4zWnmzpuFjUarYXwjVZe851dbRlo+C6rOJbJWXjskaY='
WHERE
key_id = '1acf89938da1386bf2a342a0c22f5f8e2acbffe895b564d396a404653f05f735'
AND (
token = '4zWnmzpuFjUarYXwjVZe851dbRlo+C6rOJbJWXjskaY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)