UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NgPn59E50v6Aid+jfGBYIT9VfROjC0jKvo7VO41opN0='
WHERE
key_id = '3d9249c4b2d3fa3b02c6538bcbfc6a44b8f357b9d82177a366e27d7743ad541a'
AND (
token = 'NgPn59E50v6Aid+jfGBYIT9VfROjC0jKvo7VO41opN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)