UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W27ZnNTtneQ+GhgSaEu8uXm9r1kJb9nu1Sl8lJlTbI4='
WHERE
key_id = '4e4a172a9c13aa2bbff3206123a243b34bf0752f6354290225d80d00a49b81ff'
AND (
token = 'W27ZnNTtneQ+GhgSaEu8uXm9r1kJb9nu1Sl8lJlTbI4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)