UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wPv6vqvzA87JlXuQRXJdIV6mV82xKYvxZvGObzS85og='
WHERE
key_id = '167d2db328c32bafd96b0e81aaf99d1a831d8e73d5d44f6d234cb7bb85ee0bd6'
AND (
token = 'wPv6vqvzA87JlXuQRXJdIV6mV82xKYvxZvGObzS85og='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)