UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J4dFyA5Tc+rz8AisiZw7irVz0WXk3f+mdFSjfY4X4/c='
WHERE
key_id = 'c7854f5cc64371cc669d9599992a030c03865f2d1c51d3ee186a990d7350717d'
AND (
token = 'J4dFyA5Tc+rz8AisiZw7irVz0WXk3f+mdFSjfY4X4/c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)