UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C6Qp7h1HqiZrZrPW5nzYy6xXScFgpcf4+wF45yeuwJ8='
WHERE
key_id = 'b67e9f155e4721f72007377e51347a7f9fdf7c6d776629fc19c81321b7a1ae4b'
AND (
token = 'C6Qp7h1HqiZrZrPW5nzYy6xXScFgpcf4+wF45yeuwJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)