UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OYRAHP0zviVFpntXVIaE9Jbcw1XVHn1gWJBPlzanwnU='
WHERE
key_id = '5ad5daa2e1359e63f5f2885b30d81ff9495292badca6b0bda2d868332940f89a'
AND (
token = 'OYRAHP0zviVFpntXVIaE9Jbcw1XVHn1gWJBPlzanwnU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)