UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pD1WjhkKdCMhWpCoOKvFkuC+wqfYfJ+YYcf7IygQ5Rw='
WHERE
key_id = '56638b4bf8ec3867a7fb4d294da793a3f5254b3229e41641ca8eb1719da50390'
AND (
token = 'pD1WjhkKdCMhWpCoOKvFkuC+wqfYfJ+YYcf7IygQ5Rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)