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