UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+c2exH7h89jmKblqtBctXgQjEW1qaK0rvP0eX7b18dI='
WHERE
key_id = 'f77799f3e820f504d779d2d9444f3fe7fb7d70444ebf31001eb75a307266a7f5'
AND (
token = '+c2exH7h89jmKblqtBctXgQjEW1qaK0rvP0eX7b18dI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)