UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0u7ibCWsM8hftPEQYlvXiI3f8MfI7FuajpRlKg/SOyY='
WHERE
key_id = 'f24604e1408765fb7eb59dffe15bb421b609fce4e391187f0ac181c6596c0814'
AND (
token = '0u7ibCWsM8hftPEQYlvXiI3f8MfI7FuajpRlKg/SOyY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)