UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0BhZdQCyS3aSaW441gPZ87mtzfueb5FaUZ0zOWNhHqE='
WHERE
key_id = '7bf4fa163d0c40e230a25390b98e3ac95af5f4212c0f8aba487101e587055c27'
AND (
token = '0BhZdQCyS3aSaW441gPZ87mtzfueb5FaUZ0zOWNhHqE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)