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