UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZjTUzbB5McjxBZezkttbqNJDSSWTIorokYNoPiPBNwI='
WHERE
key_id = 'da8f8efc1d12dcd74564dbf2153b8b67d2b2b0699d7a16acfd397b2569854dbc'
AND (
token = 'ZjTUzbB5McjxBZezkttbqNJDSSWTIorokYNoPiPBNwI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)